package com.cby.android.base.capture

import android.app.Activity
import android.graphics.Bitmap
import android.view.View

/**
 * @description: ScreenShotUtils
 * @author: ChenBaoYang
 * @createDate: 2022/7/21 10:05 上午
 */
object ScreenShotUtils {

    fun screenShot(activity: Activity): Bitmap {
        return view2Bitmap(activity.window.decorView)
    }
    private fun view2Bitmap(view: View): Bitmap {
        view.isDrawingCacheEnabled = true
        return view.drawingCache
    }
}